#ifndef CLIENTHANDLER_H
#define CLIENTHANDLER_H

#include <QObject>
#include <QTcpSocket>
#include "messagepackage.h"

class clientHandler : public QObject
{
    Q_OBJECT
public:
    explicit clientHandler(QTcpSocket* socket,QObject *parent = nullptr);
private:
    QTcpSocket* socket;
private slots:
    void onReadyRead();
private:
    void userRegister(QString name, QString pswd);
    void userLogin(QString name, QString pswd);
    void getAllUsers();
    void createGroup(QStringList users, QString groupName, QString sender);
    void uploadFile(messagePackage pack);
    void fileinfo();
    void downlaodFile(QString file);
signals:
    void userOnline(QString name, QTcpSocket *socket);
    void getOnlineUsers();
    void privateChat(messagePackage pack);
    void groupChat(messagePackage pack);
    void inviteGroup(messagePackage pack);
    void addGroup(QStringList users, QString groupName, QString sender);
    void groupFile(messagePackage pack);
    void meeting(messagePackage pack);
    void inviteMeeting(messagePackage pack);
    void updateMeeting(messagePackage pack);
    void quitMeeting(messagePackage pack);
    void clearMeeting(messagePackage pack);
};

#endif // CLIENTHANDLER_H
